required_packages <- c(
  "dplyr", "tidyr", "readr", "readxl", "stringr", "coin", "boot"
)

missing_packages <- required_packages[!vapply(required_packages, requireNamespace, logical(1), quietly = TRUE)]
if (length(missing_packages) > 0) {
  stop(
    "Missing packages: ",
    paste(missing_packages, collapse = ", "),
    ". Please install them before running the replication scripts."
  )
}

dir.create("outputs", showWarnings = FALSE, recursive = TRUE)

source("R/02_disfluency_tc_main_permutation.R")
source("R/03_disfluency_tc_cellwise_residuals.R")
source("R/04_within_clause_group_comparison.R")
source("R/05_silence_proportion_group_comparison.R")
source("R/06_tc_group_permutation.R")
source("R/07_relisten_group_comparison.R")
